
<div class="box box-success">
    <div class="box-header">
        <h1 class="box-title">基本信息</h1>
    </div>
    <div class="box-body">
        <div class="form-group">
            <label class="col-sm-2 control-label">交易编号 <b style="color:red">*</b></label>
            <div class="col-sm-5">
                <input type="text" name="name" class="form-control"
                       value="{{ old('name') ?: $data->name }}"
                       placeholder="最多30个字符"  required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">交易价格 <b style="color:red">*</b></label>
            <div class="col-sm-5">
                <input type="text" name="price" class="form-control"
                       value="{{ old('price') ?: $data->price }}"
                       placeholder="最多30个字符"  required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">交易量 <b style="color:red">*</b></label>
            <div class="col-sm-5">
                <input type="text" name="number" class="form-control"
                       value="{{ old('number') ?: $data->number }}"
                       placeholder="最多30个字符"  required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">排名<b style="color:red">*</b></label>
            <div class="col-sm-5">
                <input type="text" name="index" class="form-control"
                       value="{{ old('index') ?: $data->index }}"
                       placeholder="最多60个字符"  required>
            </div>
        </div>
        {{--<div class="form-group">--}}
            {{--<label class="col-sm-2 control-label">买入|卖出<b style="color:red">*</b></label>--}}
            {{--<div class="col-sm-5">--}}
                {{--{!! Form::radio('type', 1,( $data->type == 1) ? 'checked' : '') !!}买入--}}
                {{--{!! Form::radio('type', 0,( $data->type == 0) ? 'checked' : '') !!}卖出--}}
            {{--</div>--}}
        {{--</div>--}}
        <div class="form-group">
            <label class="col-sm-2 control-label">交易方式<b style="color:red">*</b></label>
            @foreach(\App\Models\Orm\Pay::$type_text as $k => $v)
                {!! Form::checkbox(
                'pay[]',
                $k,
                (!empty($data->pay) && in_array($k, explode(',', $data->pay)))
                ) !!} {{ $v }}
            @endforeach
        </div>

</div>
</div>
@section('js')
    <script>
        // 产品logo输入框自动显示已选图片
        $("input[name=logo]").change(function () {
            var obj = $(this).parents();
            var img = event.target.files[0];
            var id = 'logo';

            if (!img) {
                if ($('#' + id).length > 0) {
                    $('#' + id).remove()
                }
                return;
            }
            if (window.FileReader) {
                var im = document.createElement('img');
                im.id = id;
                if ($('#logo').length < 1) {
                    obj.append(im);
                }
                ;

                var fr = new FileReader();
                fr.onloadend = function (e) {
                    document.getElementById(id).src = e.target.result;
                    var imgObj = $('#' + id);
                    imgObj.css({
                        'width': '100px',
                        'height': '100px',
                    })
                };
                fr.readAsDataURL(img);
            }
        });
    </script>
@endsection